package com.lianjia.sh.se.esb.server.log.dao;
import com.lianjia.sh.se.esb.server.log.model.MessageLog;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yangjiangping
 * @since 2016-07-19 13:46
 */
@Repository
public class MessageLogDao {

    @Autowired
    private SqlSession sqlSession;

    /**
     * 插入日志
     * @param messageLog messageLog
     * @return
     */
    public Long insert(MessageLog messageLog) {
        Map<String, Object> paramMap = new HashMap<>();
        paramMap.put("msgUUId", messageLog.getMsgUUId());
        paramMap.put("projectType", messageLog.getProjectType());
        paramMap.put("serviceType", messageLog.getServiceType());
        paramMap.put("data", messageLog.getData());
        paramMap.put("extendData", messageLog.getExtendData());
        paramMap.put("operatorEmpNo", messageLog.getOperatorEmpNo());
        paramMap.put("operatorIp", messageLog.getOperatorIp());
        paramMap.put("operateTime", messageLog.getOperateTime());
        sqlSession.insert("MessageLogMapper.insert", paramMap);
        return (Long) paramMap.get("id");
    }
}
